/*
 * $Id$
 */
package corejs.expr;

import corejs.rt.ActivationRecord;
import corejs.rt.Function;
import corejs.stmt.Block;
import corejs.util.XmlPrinter;

/**
 *
 * @author myang
 */
public class FunctionExpr implements Expression {

   private String _name;
   private String[] _args;
   private Block _body;

   public FunctionExpr(final String name, 
                       final String[] args, 
                       final Block body) {
      _name = name;
      _args = args;
      _body = body;
   }
   
   public String getName() {
     return _name;
   }

   @Override
   public Object eval(final ActivationRecord scope) {
      return null;
   }

   public void print(final XmlPrinter printer) {
      printer.open("function").print("name", _name)
        .print("params", _args).print(_body).close();
   }

   @Override
   public Function accept(final ExpressionVisitor visitor) {
      return visitor.visitFunction(_name, _args, _body);
   }

}
